package com.gosophia.conference.action.confPrepare;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.gosophia.conferenceManagement.confPreparation.dto.ParticipatingNameListDTO;
import com.gosophia.conferenceManagement.confPreparation.ws.ConfPreparationWebService;
import com.gosophia.oa.action.JudgeCurrentUndertaker;
import com.opensymphony.xwork2.ActionSupport;
/**
 * 查看反馈情况
 * @author wangxinbing
 * @since  2011-3-25
 *  Copyright (c) 2010 Gosophia corporation All Rights Reserved
 */
@Component("GetFeedBackConditionAction")
@Scope("prototype")
public class GetFeedBackConditionAction extends ActionSupport {
	
	@Autowired
	private ConfPreparationWebService confPreparationWebService;
	@Autowired
	private JudgeCurrentUndertaker judgeCurrentUndertaker;
	private Long jobId;
	
	private List<ParticipatingNameListDTO> feedBackLists;
	
	private int totalCount = 0;
	
	private int attendCount = 0;
	
	private int notAttendCount = 0;
	
	private int notFeedBackCount = 0;

	public String execute() throws Exception{
		//判断是否匹配,如果不匹配转到异常页面
        judgeCurrentUndertaker.judgeOperationAuthority(jobId);
		feedBackLists = confPreparationWebService.findNotificationFeedbackListsByJobId(jobId);
		totalCount = feedBackLists.size();
		for(ParticipatingNameListDTO feedBack :feedBackLists){
			if("是".equals(feedBack.getIfAttend())){
				attendCount++;
			}else if("否".equals(feedBack.getIfAttend())){
				notAttendCount++;
			}else{
				notFeedBackCount++;
				feedBack.setIfAttend("-");
			}
		}
		return SUCCESS;
	}

	public Long getJobId() {
		return jobId;
	}

	public void setJobId(Long jobId) {
		this.jobId = jobId;
	}

	public List<ParticipatingNameListDTO> getFeedBackLists() {
		return feedBackLists;
	}

	public void setFeedBackLists(List<ParticipatingNameListDTO> feedBackLists) {
		this.feedBackLists = feedBackLists;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getAttendCount() {
		return attendCount;
	}

	public void setAttendCount(int attendCount) {
		this.attendCount = attendCount;
	}

	public int getNotAttendCount() {
		return notAttendCount;
	}

	public void setNotAttendCount(int notAttendCount) {
		this.notAttendCount = notAttendCount;
	}

	public int getNotFeedBackCount() {
		return notFeedBackCount;
	}

	public void setNotFeedBackCount(int notFeedBackCount) {
		this.notFeedBackCount = notFeedBackCount;
	}

}
